<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/dute_favicon_32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/dute_favicon_16x16.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">
  <link rel="manifest" href="/images/manifest.json">
  <meta name="msapplication-config" content="/images/browserconfig.xml">
  <meta http-equiv="Cache-Control" content="no-transform">
  <meta http-equiv="Cache-Control" content="no-siteapp">
  <meta name="google-site-verification" content="mpI5dkydstZXl6UcDCppqktXK0bbvqdZ6LkZ3KNk4Iw">
  <meta name="baidu-site-verification" content="code-a1LksZX2Ds">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"whitestore.top","root":"/","scheme":"Gemini","version":"7.8.0","exturl":true,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":true,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":true,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="请输入描述信息">
<meta property="og:type" content="article">
<meta property="og:title" content="深入理解JVM - 实战JVM工具（上）">
<meta property="og:url" content="https://whitestore.top/2022/01/28/shizhanjvm1/index.html">
<meta property="og:site_name" content="爱看书的阿东">
<meta property="og:description" content="请输入描述信息">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210725150255.png">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210726225744.png">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210726230102.png">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210725143806.png">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210725155849.png">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210726224400.png">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210726223315.png">
<meta property="article:published_time" content="2022-01-28T15:36:13.000Z">
<meta property="article:modified_time" content="2023-07-16T06:28:09.270Z">
<meta property="article:author" content="阿东">
<meta property="article:tag" content="请输入关键字（英文逗号分隔多个关键字）">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210725150255.png">

<link rel="canonical" href="https://whitestore.top/2022/01/28/shizhanjvm1/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>深入理解JVM - 实战JVM工具（上） | 爱看书的阿东</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

<link rel="alternate" href="/atom.xml" title="爱看书的阿东" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">爱看书的阿东</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">赐他一块白色石头，石头上写着新名</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
        <li class="menu-item menu-item-sitemap">

    <a href="/sitemap.xml" rel="section"><i class="fa fa-fw fa-sitemap"></i>站点地图</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    

  <span class="exturl github-corner" data-url="aHR0cHM6Ly9naXRodWIuY29tL2xhenlUaW1lcw==" title="Follow me on GitHub" aria-label="Follow me on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></span>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://whitestore.top/2022/01/28/shizhanjvm1/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="阿东">
      <meta itemprop="description" content="随遇而安">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="爱看书的阿东">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          深入理解JVM - 实战JVM工具（上）
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2022-01-28 23:36:13" itemprop="dateCreated datePublished" datetime="2022-01-28T23:36:13+08:00">2022-01-28</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2023-07-16 14:28:09" itemprop="dateModified" datetime="2023-07-16T14:28:09+08:00">2023-07-16</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/JVM/" itemprop="url" rel="index"><span itemprop="name">JVM</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2022/01/28/shizhanjvm1/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2022/01/28/shizhanjvm1/" itemprop="commentCount"></span>
    </a>
  </span>
  
  <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="fa fa-file-word-o"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>6.7k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="fa fa-clock-o"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>6 分钟</span>
            </span>
            <div class="post-description">请输入描述信息</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="深入理解JVM-实战JVM工具（上）"><a href="#深入理解JVM-实战JVM工具（上）" class="headerlink" title="深入理解JVM - 实战JVM工具（上）"></a>深入理解JVM - 实战JVM工具（上）</h1><h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>​    这篇文章主要介绍一下常用的JVM工具，当然介绍这些工具是没有意义的，因为不去使用吃个饭基本就会忘光，所以这篇文章主要为使用工具实操一下大致如何监控和调优代码。</p>
<h1 id="前文回顾："><a href="#前文回顾：" class="headerlink" title="前文回顾："></a>前文回顾：</h1><p>​    上一节介绍了如何解读日志，可以网上搜一些调优的案例代码亲自试验一下，可以发现不同的机器哪怕是一样的JDK版本也会出现不同的效果，比如IDEA和Eclipse中执行的结果可能有出入，同时JVM本身产生的对象也会影响日志的结果。</p>
<p>​    解读日志是掌握JVM的基本功，在掌握基本的解读能力之后，这篇文章来讲述JVM的工具实战技巧。</p>
<a id="more"></a>

<h1 id="概述"><a href="#概述" class="headerlink" title="概述"></a>概述</h1><p>​    这篇文章主要讲述如何根据最原始的命令jstat对于JVM进行分析和调优，当然并不是所有的案例都可以通过调优实现的，所以这里也会有个别通过修复代码BUG进行调优的案例。</p>
<p>​    之所以拆成上和下是考虑到文章篇幅的问题，个人也不喜欢动不动就万字的文章，但是要分析和说明案例的场景确实要不少的文字描述，所以<strong>这些文章会看的很累！</strong>请在精力较好的时候阅读。</p>
<h1 id="常用工具介绍："><a href="#常用工具介绍：" class="headerlink" title="常用工具介绍："></a>常用工具介绍：</h1><p>​    工具简单提一下，其实写出来没啥意义，没有几个人会去专门背命令的，更多的是在实际的案例上如何使用才是重点。</p>
<h2 id="jstat命令："><a href="#jstat命令：" class="headerlink" title="jstat命令："></a>jstat命令：</h2><h3 id="命令的格式："><a href="#命令的格式：" class="headerlink" title="命令的格式："></a>命令的格式：</h3><p>​    这里介绍一些比较常见的用法：</p>
<ul>
<li><code>jstat -gc PID</code>查看当前JVM进程的使用情况</li>
<li><code>jstat -gccapacity PID</code> 堆内存的分析</li>
<li><code>jstat -gcnew PID</code>：年轻代的GC分析，这里的TT和MTT可以看到对象在年轻代存活的年龄和存活的最大年龄</li>
<li><code>jstat -gcnewcapacitry PID</code> 年轻代分析</li>
<li><code>jstat -gcold PID</code> 老年代GC分析</li>
<li><code>jstat -gcoldcapacitry PID</code>老年代内存分析</li>
<li><code>jstat -gcmetacapacity PID</code> 元数据区的分析</li>
</ul>
<h3 id="参数介绍"><a href="#参数介绍" class="headerlink" title="参数介绍"></a>参数介绍</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"> S0C    S1C    S0U    S1U      EC       EU        OC         OU       MC     MU    CCSC   CCSU   YGC     YGCT    FGC    FGCT     GCT</span><br><span class="line"><span class="number">10240.0</span> <span class="number">10240.0</span>  <span class="number">0.0</span>    <span class="number">0.0</span>   <span class="number">81920.0</span>  <span class="number">13107.5</span>   <span class="number">102400.0</span>     <span class="number">0.0</span>     <span class="number">4480.0</span> <span class="number">776.9</span>  <span class="number">384.0</span>   <span class="number">76.6</span>       <span class="number">0</span>    <span class="number">0.000</span>   <span class="number">0</span>      <span class="number">0.000</span>    <span class="number">0.000</span></span><br></pre></td></tr></table></figure>

<p>​    下面是根据上面的参数对应下方的参数解释：</p>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210725150255.png" alt=""></p>
<h2 id="Jmap-命令"><a href="#Jmap-命令" class="headerlink" title="Jmap 命令"></a>Jmap 命令</h2><p>​    关键作用：到底是哪个对象占用的内存是最多的。</p>
<p>使用案例：</p>
<ul>
<li><code>Jmap -heap PID</code>：打印比如说Eden区域总容量，已经使用容量，剩余容量等等。</li>
<li><code>Jmap -histo PID</code>：了解对象的分布情况，可以打印各种class对象的占用比情况，通常为string占用最多</li>
<li><code>jmap -dump:live,format=b,file=dump,hprof PID</code>：查看当前堆的快照内容</li>
</ul>
<h2 id="Jhat-命令"><a href="#Jhat-命令" class="headerlink" title="Jhat 命令"></a>Jhat 命令</h2><p>使用案例：</p>
<ul>
<li><code>jhat dump.hprof -port 7000</code>：使用Jhat 在浏览器分析，可以使用浏览器去分析上文出现的堆快照</li>
</ul>
<h1 id="线上系统常见监控手段："><a href="#线上系统常见监控手段：" class="headerlink" title="线上系统常见监控手段："></a>线上系统常见监控手段：</h1><ol>
<li>在系统的高低峰之前执行<strong>jstat/ jmap/ jhat</strong> 的工具看看JVM是否正常运行。</li>
<li><strong>Zabbix，openfalcon，ganglia</strong> 等测试工具</li>
</ol>
<h1 id="实战案例场景"><a href="#实战案例场景" class="headerlink" title="实战案例场景"></a>实战案例场景</h1><p>​    注意，代码运行在<strong>Jdk8</strong>的版本上。</p>
<p>​    在进行具体的调优之前，有必要说明一下调优的场景和模拟的业务场景，所以在介绍案例实际操作之前，需要先说明一下基本的业务场景：</p>
<h2 id="高并发的APP系统"><a href="#高并发的APP系统" class="headerlink" title="高并发的APP系统:"></a>高并发的APP系统:</h2><p>​    按照之前的调优案例，首先不介绍复杂的业务，而是从一个简单的社交APP入手，我们都知道一些社交APP为了吸引流量会拉上一些明星进行直播，这一类的APP的高并发场景在哪呢？</p>
<p>​    我们假设如果你喜欢的明星突然说在某个社交APP直播了，你首先毫无疑问会下载APP，同时搜索你喜欢的明显进入他的 <strong>个人主页</strong>，重点来了，我们试想一下个人主页都会有什么，毫无疑问是一些个人动态日志或者一些图片和文字等内容。</p>
<p>​    接着我们再分析：平时一两个人来来看，特别是流量比较少的时候，我们可以甚至可以直接从数据库加载，但是一旦这个明星被推广并且非常的热门，毫无疑问会吸引一大波人访问，比如十万的QPS进入，这时候靠后端肯定是顶不住的，我们毫无疑问需要引入Redis，并且给图片等非常消耗资源的内容存到图片服务器分压，这时候可以画一个简单的结构图如下：</p>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210726225744.png" alt=""></p>
<p>​    图中的分析可以得知这里会出现大量的 <strong>小对象</strong>，我们假设每一个请求会带来5M的文字对象或者图片对象，那么一个2G的新生代毫无疑问可能会瞬间被挤满（哪怕是Redis可以分担），这里就会出现一个问题，就是新生代在回收的时候发现还有很多对象在使用，导致<strong>新生代快速进入老年代</strong>，所以这个案例毫无疑问就是要保证新生代能有足够的对象存放。</p>
<p>​    这就是最为简单的一个案例模拟，为什么要讲这个那里呢？这里要提到网上经常会出现的两个参数</p>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210726230102.png" alt=""></p>
<p>​    这两个参数的意思是开启CMS老年代回收之后的内存碎片整理，这里我们再次回忆一下这个参数的实际效果：</p>
<p>​    当CMS在默认最后一步并发清理的时候（<strong>CMS执行四个步骤：初始标记，并发标记，重新标记，并发整理</strong>），如果此时除开触发92%老年代回收条件的剩余8%被大量进入老年代的新生代对象占满而无法分配，就会触发FULL GC，这个过程称之为：<code>conccurent mode fail</code>（其实就是并发执行失败）这时就会喊出serrial这个老人家过来大喊一声”stop world”并且进行单线程的回收。</p>
<p>​    重点来了，在回收完成之后，serrial退居幕后，此时CMS会根据上面的参数判定，在第五次FULL GC的时候对于内存碎片进行整理，至于内存碎片是什么，这里可以自行百度标记-清理算法的缺点就可以明白，也可以看个人之前的文章进行了解：</p>
<p>​    <span class="exturl" data-url="aHR0cHM6Ly9qdWVqaW4uY24vcG9zdC82OTg0MzU2NTQzNDcwNzY0MDY4I2hlYWRpbmctOA==" title="https://juejin.cn/post/6984356543470764068#heading-8">深入理解JVM - 垃圾回收算法<i class="fa fa-external-link"></i></span></p>
<p>​    这个5其实是网上有人推荐的参数，因为多数情况下不需要每次FULL GC都进行内存碎片整理，但是实际上上面这个模拟案例显然不能设置这么多次，因为瞬时流量创建的对象过多，我们可以牺牲一些老年代的整理时间，来实现老年代的内存碎片规整化，尽量的减少了FULL GC的次数，这样用户进入主页的时候就不会一直转圈圈进不去了。</p>
<h2 id="电商系统："><a href="#电商系统：" class="headerlink" title="电商系统："></a>电商系统：</h2><p>​    这个案例在专栏之前的文章使用过，这里原样拷贝过来了：</p>
<p>背景：</p>
<p>​    假设一个电商网站每天的访问量是20次/人，如果要上亿次的请求需要每天500万次的请求，同时如果这500万人按照10%的下单的标准，则是每天50万人会进行下单的操作，而下单操作按照2/8原则在4小时之内付款完成，那么此时的占用大概是<strong>50万/4小时 == 500000 / 14400</strong>,大概每秒也就 <strong>34个订单</strong>左右，这种情况下发现系统的影响并不会很大，老年代发生回收大概为几个小时一次，完全可以接受。</p>
<p>高并发的场景</p>
<p>​    但是如果在秒杀的场景，情况又不一样了，如果在一秒内来1000笔订单，该如何处理？我们假设如果是3台机器，则每台需要处理至少<strong>300条</strong>请求。</p>
<p>计算JVM消耗</p>
<p>​    根据上文模拟场景，假设每秒300个请求按照每个对象1KB来看，每一台机器要处理大概300KB的内存，把一个订单系统的处理对象放大10倍，则是3000KB，如果在算上其他的操作比如订单处理，则需要30000KB = 30MB的占用。</p>
<p>​    如果虚拟机栈每个占用1M，则几百个线程需要几百M的空间。<strong>如果是4核心8G的机器</strong>，则分<strong>4G给JVM</strong>，4G中分1G给虚拟机栈500M多M，方法区：256M，堆外内存给256M。同时开启内存担保机制（jdk6之后不需要制定参数）然后<strong>新生代和老年代各分配1.5G</strong>。</p>
<p>​    按照上面的换算，我们发现如果每秒都来30M对象，那么1200M左右的EDEN区域（8：1：1的比例大概是1200给EDEN），大概40秒就能把新生代塞满，假设每次请求新生代会留下<strong>200M左右</strong>的存活对象会进入SURVIOR区域，但是我们发现配比的survior区域只有150M是无法进入Survior区域的，根据内存分配担保的机制，这些对象会分配到老年代，这也意味着一些即将成为垃圾的对象提前进入了老年代导致无法被正常回收！</p>
<p>​    按照这样的分配效率不到一分钟新生代就会塞满。200M对象进入年代最多8、9次的minor gc就会导致Full gc，也就是说 <strong>8、9分钟就会触发老年代回收</strong>，这个触发的概率就十分高了，这会严重导致系统卡顿并且出现用户线程的停顿现象。</p>
<p>​    但是如果Survior空间足够，那么此时回收进入到Survior空间之后，在下一次minor gc基本也为垃圾对象被回收了。</p>
<p>问题结构图：</p>
<p>​    根据上面的介绍，可以得出下面的问题结构图：</p>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210725143806.png" alt=""></p>
<h3 id="如何优化"><a href="#如何优化" class="headerlink" title="如何优化"></a>如何优化</h3><p>​    这里直接说一下优化的思路：</p>
<ol>
<li>首先，我们需要扩大Survior的空间或者扩大新生代的大小，比如把新生代扩大到2G的空间。</li>
<li>也可以通过加机器的方式扩大内存的空间</li>
<li>注意这里主要为计算的业务，不需要保证低延迟，所以使用普通的分代收集器CMS+ParNew即可。</li>
</ol>
<h3 id="代码模拟："><a href="#代码模拟：" class="headerlink" title="代码模拟："></a>代码模拟：</h3><p>​    如果用代码模拟，我们并不需要用那么大的内存空间模拟，我们用下面的代码简单的还原上面的情况：（当然参数并不是百分之百符合，但是可以模拟出业务场景存在的问题以及解决手段）</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 运行参数：-XX:NewSize=104857600 -XX:MaxNewSize=104857600 -XX:InitialHeapSize=209715200 -XX:MaxHeapSize=209715200 -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=15 -XX:PretenureSizeThreshold=20971520 -XX:+UseParNewGC-XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:gc-%t.log</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> zxd</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@version</span> v1.0.0</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Package</span> : com.zxd.interview.minorGc</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Description</span> : 测试案例：测试垃圾回收动销率</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@Create</span> on : 2021/7/25 11:47</span></span><br><span class="line"><span class="comment"> **/</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Demo1</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keyword">int</span> _1M = <span class="number">1024</span> *  <span class="number">1024</span>;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> Exception </span>&#123;</span><br><span class="line">        Thread.sleep(<span class="number">30000</span>);</span><br><span class="line">        <span class="keyword">while</span>(<span class="keyword">true</span>)&#123;</span><br><span class="line">            loadData();</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">loadData</span><span class="params">()</span> <span class="keyword">throws</span> Exception</span>&#123;</span><br><span class="line">        <span class="keyword">byte</span>[] data = <span class="keyword">null</span>;</span><br><span class="line">        <span class="comment">// 循环分配40M的对象</span></span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; <span class="number">4</span>; i++) &#123;</span><br><span class="line">            data = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">10</span> * _1M];</span><br><span class="line">        &#125;</span><br><span class="line">        data = <span class="keyword">null</span>;</span><br><span class="line">		<span class="comment">// 存活20M的对象</span></span><br><span class="line">        <span class="keyword">byte</span>[] data1 = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">10</span> * _1M];</span><br><span class="line">        <span class="keyword">byte</span>[] data2 = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">10</span> * _1M];</span><br><span class="line">        <span class="comment">// 临时生成20M保证YGC</span></span><br><span class="line">        <span class="keyword">byte</span>[] data3 = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">10</span> * _1M];</span><br><span class="line">        data3 = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">10</span> * _1M];</span><br><span class="line"></span><br><span class="line">        Thread.sleep(<span class="number">1000</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>​    从代码中可以看到我们使用无限循环不断的往新生代分配对象，同时触发新生代的回收，可以看到此时Survior区域也是放不下老年代的，所以新生代的存活对象会直接进入到老年代。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">-XX:NewSize=<span class="number">104857600</span> </span><br><span class="line">-XX:MaxNewSize=<span class="number">104857600</span></span><br><span class="line">-XX:InitialHeapSize=<span class="number">209715200</span></span><br><span class="line">-XX:MaxHeapSize=<span class="number">209715200</span></span><br><span class="line">-XX:SurvivorRatio=<span class="number">8</span></span><br><span class="line">-XX:MaxTenuringThreshold=<span class="number">15</span></span><br><span class="line">-XX:PretenureSizeThreshold=<span class="number">20971520</span></span><br><span class="line">-XX:+UseParNewGC</span><br><span class="line">-XX:+UseConcMarkSweepGC</span><br><span class="line">-XX:+PrintGCDetails</span><br><span class="line">-XX:+PrintGCTimeStamps</span><br><span class="line">-Xloggc:gc-%t.log</span><br></pre></td></tr></table></figure>

<p>​    这里的配置对象超过20M之后直接进入老年代，而根据模拟代码的情况，通常是不会直接进入老年代的。</p>
<h3 id="调优前的运行效果："><a href="#调优前的运行效果：" class="headerlink" title="调优前的运行效果："></a>调优前的运行效果：</h3><p>​    在启动代码的时候，我们需要立刻使用如下命令：</p>
<p>​    第一步我们需要输入<code>jps</code>，命令查看当前的JVM线程：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">34096 Jps</span><br><span class="line">38820 Demo1</span><br></pre></td></tr></table></figure>

<p>​    接着我们需要立刻赶快执行上文提到的<code>Jstat</code>命令：</p>
<p>​    <code>jstat -gc 38820 1000 10</code></p>
<p>​    然后我们可以看到如下的结果：</p>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210725155849.png" alt=""></p>
<p>下面来分析上面的结果：</p>
<p>​    首先我们看一下S1的区域，在1秒过后他增长了1634K的大小，大概也就1.5M左右，这里可以认为是未知对象，同时可以看到在下一秒他已经被垃圾回收掉了。这里明显可以看到执行了一次 Young Gc，并且执行的时间为0.016s，当然这个回收是很难感知的。从新生代的回收也可以看出，我们存活的对象是直接进入老年代的，没有进入survior区域，导致survior区域存放的只是一些jvm产生的小对象。导致每次Young GC之后存活的20M对象都进入了老年代。</p>
<p>​    接着我们来看下中间的部分：EU部分突然变成了0.0。毫无疑问是垃圾对象全部被回收了，也可以看新生代的回收时间居然一秒比一秒更长（最后一次参数，注意老年代的回收时间在倒数第二个参数）</p>
<p>​    <strong>为什么老年代的回收反而要比新生代的时间更短？</strong></p>
<p>​    其实从业务场景也可以推测出来，老年代的回收是根据新生代的回收出现的，但是新生代由于存在太多的对象进入老年代，根据对象分配的担保原则需要不断计算历代进入老年代的对象平均大小，同时这个阶段相当于新生代需要等待老年代进行判断回收完成才能操作，<strong>所以导致新生代的回收速度慢于老年代的速度</strong></p>
<h3 id="调优后的运行效果："><a href="#调优后的运行效果：" class="headerlink" title="调优后的运行效果："></a>调优后的运行效果：</h3><p>​    首先我们看一下调优之后的运行参数：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">-XX:NewSize=<span class="number">209715200</span> </span><br><span class="line">-XX:MaxNewSize=<span class="number">209715200</span> </span><br><span class="line">-XX:InitialHeapSize=<span class="number">314572800</span> </span><br><span class="line">-XX:MaxHeapSize=<span class="number">314572800</span></span><br><span class="line">-XX:SurvivorRatio=<span class="number">2</span>  </span><br><span class="line">-XX:MaxTenuringThreshold=<span class="number">15</span></span><br><span class="line">-XX:PretenureSizeThreshold=<span class="number">20971520</span></span><br><span class="line">-XX:+UseParNewGC </span><br><span class="line">-XX:+UseConcMarkSweepGC</span><br><span class="line">-XX:+PrintGCDetails </span><br><span class="line">-XX:+PrintGCTimeStamps </span><br><span class="line">-Xloggc:gc-%t.log</span><br></pre></td></tr></table></figure>

<p>​    之前我们说过，我们可以扩大新生代的空间，或者调整survior空间的大小，所以这里主要把堆内存扩大到了300M，同时吧eden区域的比例改为<strong>2:1:1</strong> 的比例，其他参数基本没有过多的变化。</p>
<p>​    这里还有其他的参数可以设置，下面介绍可以优化的配置：</p>
<p>​    一个参数是“<strong>-XX:+CMSParallelInitialMarkEnabled</strong>”，这个参数会在CMS垃圾回收器的“初始标记”阶段开启多线程并发执行。</p>
<p>​    另外一个参数是“<strong>-XX:+CMSScavengeBeforeRemark</strong>”，这个参数会在CMS的重新标记阶段之前，先尽量执行一次Young GC。</p>
<p>​    接下来同样运行下面的命令：<code>jstat -gc 18032 1000 100</code>查看当前的堆使用情况：</p>
<p>这里再次强调参数标头对应的含义：</p>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210726224400.png" alt=""></p>
<p>​    下面是运行的结果</p>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210726223315.png" alt="调优之后的GC情况"></p>
<p>​    从上面的内容可以看到，FULL GC的时间居然已经变成了0，所有的时间都在于Young GC上面。其他也可以看到survior区域每次都可以存放下所有的eden区域存活对象，这也和之前案例讲述的调优结果是一致的。</p>
<h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><p>​    上面两个案例应该足以说明新生代优化的套路了，基本就是用jstat看看新生代老年代的变化情况，当然实际情况肯定没有这么简单，下一小节</p>
<h1 id="写在最后"><a href="#写在最后" class="headerlink" title="写在最后"></a>写在最后</h1><p>​    文字功底实在一般，如果有任何不懂的地方感谢反馈，个人会在闲暇之余不断重写让尽可能多的人看懂。</p>
<p>​    </p>
<h1 id="思考题："><a href="#思考题：" class="headerlink" title="思考题："></a>思考题：</h1><p>​    做JVM调优的时候，可以根据下面的问题来进行思考：</p>
<ul>
<li>你们公司有没有类似这里讲的JVM参数模板？</li>
<li>假如你是公司的架构师，结合你们公司的大部分业务系统的实际情况，会如何定制一套JVM参数模板？</li>
<li>是否你们公司有各种不同配置的机器？</li>
<li>针对不同配置的机器如何定制JVM参数模板？</li>
<li>你们公司有没有那种特例的系统，比如并发量特别高或者数据量非常大？</li>
<li>对特例系统该如何进行优化?</li>
</ul>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/kity@2.0.4/dist/kity.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/kityminder-core@1.4.50/dist/kityminder.core.min.js"></script><script defer="true" type="text/javascript" src="https://cdn.jsdelivr.net/npm/hexo-simple-mindmap@0.2.0/dist/mindmap.min.js"></script><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/hexo-simple-mindmap@0.2.0/dist/mindmap.min.css">
    </div>

    
    
    
        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>lazytime
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="https://whitestore.top/2022/01/28/shizhanjvm1/" title="深入理解JVM - 实战JVM工具（上）">https://whitestore.top/2022/01/28/shizhanjvm1/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <span class="exturl" data-url="aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLzQuMC96aC1DTg=="><i class="fa fa-fw fa-creative-commons"></i>BY-NC</span> 许可协议。转载请注明出处！
  </li>
</ul>
</div>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/JVM/" rel="tag"># JVM</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2022/01/28/jiedugc/" rel="prev" title="深入理解JVM - 解读GC日志">
      <i class="fa fa-chevron-left"></i> 深入理解JVM - 解读GC日志
    </a></div>
      <div class="post-nav-item">
    <a href="/2022/01/28/gupiaozuoshou/" rel="next" title="《股票作手回忆录》读书笔记">
      《股票作手回忆录》读书笔记 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#深入理解JVM-实战JVM工具（上）"><span class="nav-number">1.</span> <span class="nav-text">深入理解JVM - 实战JVM工具（上）</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#前言"><span class="nav-number">2.</span> <span class="nav-text">前言</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#前文回顾："><span class="nav-number">3.</span> <span class="nav-text">前文回顾：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#概述"><span class="nav-number">4.</span> <span class="nav-text">概述</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#常用工具介绍："><span class="nav-number">5.</span> <span class="nav-text">常用工具介绍：</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#jstat命令："><span class="nav-number">5.1.</span> <span class="nav-text">jstat命令：</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#命令的格式："><span class="nav-number">5.1.1.</span> <span class="nav-text">命令的格式：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#参数介绍"><span class="nav-number">5.1.2.</span> <span class="nav-text">参数介绍</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Jmap-命令"><span class="nav-number">5.2.</span> <span class="nav-text">Jmap 命令</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Jhat-命令"><span class="nav-number">5.3.</span> <span class="nav-text">Jhat 命令</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#线上系统常见监控手段："><span class="nav-number">6.</span> <span class="nav-text">线上系统常见监控手段：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#实战案例场景"><span class="nav-number">7.</span> <span class="nav-text">实战案例场景</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#高并发的APP系统"><span class="nav-number">7.1.</span> <span class="nav-text">高并发的APP系统:</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#电商系统："><span class="nav-number">7.2.</span> <span class="nav-text">电商系统：</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#如何优化"><span class="nav-number">7.2.1.</span> <span class="nav-text">如何优化</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#代码模拟："><span class="nav-number">7.2.2.</span> <span class="nav-text">代码模拟：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#调优前的运行效果："><span class="nav-number">7.2.3.</span> <span class="nav-text">调优前的运行效果：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#调优后的运行效果："><span class="nav-number">7.2.4.</span> <span class="nav-text">调优后的运行效果：</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#总结"><span class="nav-number">7.3.</span> <span class="nav-text">总结</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#写在最后"><span class="nav-number">8.</span> <span class="nav-text">写在最后</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#思考题："><span class="nav-number">9.</span> <span class="nav-text">思考题：</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">阿东</p>
  <div class="site-description" itemprop="description">随遇而安</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">239</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">36</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">37</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL2xhenlUaW1lcw==" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;lazyTimes"><i class="fa fa-fw fa-github"></i>GitHub</span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="bWFpbHRvOjEwOTc0ODM1MDhAcXEuY29t" title="E-Mail → mailto:1097483508@qq.com"><i class="fa fa-fw fa-envelope"></i>E-Mail</span>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title">
      <i class="fa fa-fw fa-link"></i>
      友情链接
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <span class="exturl" data-url="aHR0cHM6Ly93d3cuNTJwb2ppZS5jbi9ob21lLnBocD9tb2Q9c3BhY2UmdWlkPTE0OTc3MTgmZG89dGhyZWFkJnZpZXc9bWUmZnJvbT1zcGFjZQ==" title="https:&#x2F;&#x2F;www.52pojie.cn&#x2F;home.php?mod&#x3D;space&amp;uid&#x3D;1497718&amp;do&#x3D;thread&amp;view&#x3D;me&amp;from&#x3D;space">吾爱破解</span>
        </li>
        <li class="links-of-blogroll-item">
          <span class="exturl" data-url="aHR0cHM6Ly9qdWVqaW4uaW0vdXNlci8yOTk5MTIzNDUyNjI2MzY2" title="https:&#x2F;&#x2F;juejin.im&#x2F;user&#x2F;2999123452626366">掘金</span>
        </li>
        <li class="links-of-blogroll-item">
          <span class="exturl" data-url="aHR0cHM6Ly9zZWdtZW50ZmF1bHQuY29tL3UvbGF6eXRpbWVz" title="https:&#x2F;&#x2F;segmentfault.com&#x2F;u&#x2F;lazytimes">思否</span>
        </li>
    </ul>
  </div>

      </div>

      <div class="wechat_OA">
        <span>欢迎关注我的公众号</span>
        <br>
          <!-- 这里添加你的二维码图片 -->
        <img src ="https://adong-picture.oss-cn-shenzhen.aliyuncs.com/adong/wechat_channel.jpg">
      </div>
        <div class="back-to-top motion-element">
          <i class="fa fa-arrow-up"></i>
          <span>0%</span>
        </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">阿东</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
      <span class="post-meta-item-text">站点总字数：</span>
    <span title="站点总字数">2m</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span class="post-meta-item-text">站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">29:50</span>
</div>
  <div class="powered-by">由 <span class="exturl theme-link" data-url="aHR0cHM6Ly9oZXhvLmlv">Hexo</span> & <span class="exturl theme-link" data-url="aHR0cHM6Ly90aGVtZS1uZXh0Lm9yZw==">NexT.Gemini</span> 强力驱动
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : true,
      appId      : 'qMUpEEvBgXaMDD1b0ftgi9xr-gzGzoHsz',
      appKey     : 'UCdfT4Rfih6MO6y8DI4fstf6',
      placeholder: "Just go go",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : false,
      lang       : 'zh-CN' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

</body>
</html>
